import * as echarts from '@/plugin/lime-echart/static/echarts.min'
import RegionModel from '@/common/model/Region'
export default {
    data() {
        return {
            chart1Option:{},
            chart1:{
                position: [],
                params: [95,60],
            },
            chart2Option:{},
            chart2:{
                position: [],
                params: [95,60],
            },
            chart3Option:{},
            chart3:{
                position: [],
                params: [],
            },
            chart4Option:{},
            chart4:{
                position: [],
                params: [],
            },
            chart5Option:{},
            chart5:{
                position: [],
                params: [],
            },
            chart6Option:{},
            chart6:{
                position: [],
                params: {},
                chart:null
            },
            chart7:{
                data:[]
            },
            countryTableData:[],
            revenueData:[],
            treeData: [],
            detailByDistributionData:[],
            chart2Load:false,
        }
    },
    created() {
        // 获取地区数据
        this.getTreeData()
    },
    methods: {
        // 营收数据
        async loadChart1(reload){
            uni.showLoading()
            this.revenueData = await this.revenueListByType();
            this.countryTableData = await this.listByCity();
            this.detailByDistributionData = await this.getDetailByDistribution();
            this.agencyData = await this.agencyOrder();
            if(this.searchCityId != ''){
                this.detailByCity(this.searchCityId)
            }
            this.getChart1Option(this.revenueData);
            this.getChart2Option(this.revenueData);
            this.getChart3Option(this.revenueData);
            this.getChart4Option(this.detailByDistributionData);
            this.getChart6Option();
            if(!reload){

                // this.getChart7Option();//商城营收数据
            }
            uni.hideLoading()
        },
        // 成本数据
        async loadChart2(reload){
            if(this.chart2Load && !reload){
                return;
            }
            uni.showLoading()
            const costData = await this.costListByType()
            this.getChart5Option(costData);
            // const files = await this.getFiles();
            this.chart2Load = true;
            uni.hideLoading()
        },
        //总营收
        getChart1Option(data){
            const xAxisData = data.map(item=>item.batchNo);
            let txt = '万'
            const seriesData = data.map(item=>this.getNumber(item.totalRevenue));
            this.chart1Option={
                color: ['#165DFF', '#F7BA1E', '#14C9C9'],
                xAxis: {
                    type: 'category',
                    data: xAxisData
                },
                yAxis: [
                    {
                        // name: txt,
                        type: 'value'
                    }
                ],
                grid:{
                    left: '10',
                    right: '10',
                    bottom: '10',
                    top: '30',
                    containLabel: true
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    },
                    position: (point, params, dom, rect, size) => {
                        // 假设自定义的tooltips尺寸
                        // const box = [140, 70]
                        // // 偏移
                        // const offsetX = point[0] < size.viewSize[0] / 2 ? 20 : -box[0] - 20;
                        // const offsetY = point[1] < size.viewSize[1] / 2 ? 20 : -box[1] - 20;
                        // const x = point[0] + offsetX;
                        // const y = point[1] + offsetY;
                        //
                        // this.chart1.position = [x, y]
                        this.chart1.position = [85,85]
                        this.chart1.params = params
                    },
                    formatter: (params, ticket, callback) => {

                    }
                },
                series: [
                    {
                        data: seriesData,
                        type: 'line'
                    }
                ]
            };
            this.$refs.chart1.init(echarts, chart=> {
                chart.setOption(this.chart1Option);
                chart.dispatchAction({
                    type: 'showTip',
                    seriesIndex: 0,
                    dataIndex: 0
                })
            });
        },
        //总利润
        getChart2Option(data){
            let txt = '万'
            const xAxisData = data.map(item=>item.batchNo);
            //总毛利润
            const seriesData = data.map(item=>this.getNumber(item.totalProfit));
            //总净利润
            const seriesData1 = data.map(item=>this.getNumber(item.totalNetProfit));
            this.chart2Option={
                legend: {
                    data: ['总毛利润', '总净利润']
                },
                color: ['#165DFF', '#F7BA1E', '#14C9C9'],
                xAxis: {
                    type: 'category',
                    data: xAxisData
                },
                yAxis: {
                    // name: txt,
                    type: 'value'
                },
                grid:{
                    left: '10',
                    right: '10',
                    bottom: '10',
                    top: '50',
                    containLabel: true
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    },
                    position: (point, params, dom, rect, size) => {
                        // 假设自定义的tooltips尺寸
                        // const box = [140, 70]
                        // // 偏移
                        // const offsetX = point[0] < size.viewSize[0] / 2 ? 20 : -box[0] - 20;
                        // const offsetY = point[1] < size.viewSize[1] / 2 ? 20 : -box[1] - 20;
                        // const x = point[0] + offsetX;
                        // const y = point[1] + offsetY;
                        // this.chart2.position = [x, y]
                        this.chart2.position = [85,85]
                        this.chart2.params = params
                    },
                    formatter: (params, ticket, callback) => {

                    }
                },
                series:[
                    {
                        name:"总毛利润",
                        data: seriesData,
                        barMaxWidth: 40,
                        type: 'bar'
                    },{
                        name:"总净利润",
                        data: seriesData1,
                        barMaxWidth: 40,
                        type: 'line'
                    }
                ]
                // series: [
                //     {
                //         name:"总利润",
                //         data: [130, 240, 244, 218, 435, 647, 460],
                //         type: 'bar'
                //     },{
                //         name:"毛利率",
                //         data: [150, 230, 224, 218, 135, 147, 260],
                //         type: 'line'
                //     }, {
                //         name:"净利润",
                //         data: [123, 330, 254, 218, 165, 147, 260],
                //         type: 'line'
                //     }
                // ]
            };
            this.$refs.chart2.init(echarts, chart=> {
                chart.setOption(this.chart2Option);
                chart.dispatchAction({
                    type: 'showTip',
                    seriesIndex: 0,
                    dataIndex: 0
                })
            });
        },
        //招商 商城
        getChart3Option(data,showName){
            const xAxisData = data.map(item=>item.batchNo);
            const seriesData1 = data.map(item=>{
                if(showName){
                    return {
                        value:this.getNumber(item.totalRevenue),
                        name:item.mallName
                    }
                }else{
                    return this.getNumber(item.totalRevenue)
                }
            });
            const seriesData2 = data.map(item=>{
                if(showName){
                    return {
                        value:this.getNumber(item.totalNetProfit),
                        name:item.mallName
                    }
                }else{
                    return this.getNumber(item.totalNetProfit)
                }
            });
            const name = this.isShop ? '招商' : '商城'
            this.chart3Option={
                legend: {
                    data: [name+'总营收', name+'总利润']
                },
                color: [ '#F7BA1E', '#14C9C9'],
                xAxis: {
                    type: 'category',
                    data: xAxisData
                },
                yAxis: {
                    type: 'value'
                },
                grid:{
                    left: '10',
                    right: '10',
                    bottom: '10',
                    top: '50',
                    containLabel: true
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    },
                    position: (point, params, dom, rect, size) => {
                        // 假设自定义的tooltips尺寸
                        const box = [140, 70]
                        // 偏移
                        const offsetX = point[0] < size.viewSize[0] / 2 ? 20 : -box[0] - 20;
                        const offsetY = point[1] < size.viewSize[1] / 2 ? 20 : -box[1] - 20;
                        const x = point[0] + offsetX;
                        const y = point[1] + offsetY;
                        // this.chart3.position = [x, y]
                        this.chart3.position = [85,85]
                        console.log(params)
                        this.chart3.params = params
                    },
                    formatter: (params, ticket, callback) => {

                    }
                },
                series: [
                    {
                        name:name+"总营收",
                        data: seriesData1,
                        type: 'line'
                    }, {
                        name:name+"总利润",
                        data: seriesData2,
                        type: 'line'
                    }
                ]
            };
            this.$refs.chart3.init(echarts, chart=> {
                chart.setOption(this.chart3Option);
                chart.dispatchAction({
                    type: 'showTip',
                    seriesIndex: 0,
                    dataIndex: 0
                })
            });
        },
        //总营收分配
        getChart4Option(data){
            var colorList = ['#165DFF','#FF8D1F','#7B3DD1','#469AFA','#F7BA1E','#D92ED9','#F7BA1E'];
            const seriesData = data.map(item=>{
                return {
                    value:this.getNumber(item.useAmount),
                    name:item.purpose
                }
            })
            this.chart4Option={
                series: [
                    {
                        type: "pie",
                        radius: [0, "96%"],
                        label: {
                            position: "inner",
                            color:'#FFFFFF',
                            rotate:'radial',
                            formatter: "{d}%",  //{a}：系列名。{b}：数据名。{c}：数据值。{d}：百分比。
                        },
                        itemStyle: {
                            normal: {
                                borderWidth: 0,
                                color: function (params) {
                                    return colorList[params.dataIndex];
                                },
                            },
                        },
                        selectedMode: "single",
                        data: seriesData,
                    }]
            };
            this.$refs.chart4.init(echarts, chart=> {
                chart.setOption(this.chart4Option);
            });
        },
        //销售公司成本、利润(税后)
        getChart5Option(data){
            let txt = '万'
            const xAxisData = data.map(item=>item.batchNo);
            //酒厂出厂成本
            const seriesData = data.map(item=>this.getNumber(item.totalCost));
            //销售公司成本
            const seriesData1 = data.map(item=>this.getNumber(item.totalSaleCost));
            const option={
                color: ['#165DFF', '#14C9C9'],
                xAxis: {
                    type: 'category',
                    data: xAxisData
                },
                yAxis: {
                    // name: txt,
                    type: 'value'
                },
                grid:{
                    left: '10',
                    right: '10',
                    bottom: '10',
                    top: '30',
                    containLabel: true
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    },
                    position: (point, params, dom, rect, size) => {
                        // 假设自定义的tooltips尺寸
                        // const box = [140, 70]
                        // // 偏移
                        // const offsetX = point[0] < size.viewSize[0] / 2 ? 20 : -box[0] - 20;
                        // const offsetY = point[1] < size.viewSize[1] / 2 ? 20 : -box[1] - 20;
                        // const x = point[0] + offsetX;
                        // const y = point[1] + offsetY;
                        // this.chart5.position = [x, y]
                        this.chart5.position = [85,85]
                        // console.log(params)
                        this.chart5.params = params
                    },
                    formatter: (params, ticket, callback) => {
                    }
                },
                series: [
                    {
                        name:"酒厂出厂成本",
                        type: 'bar',
                        stack: 'Ad',
                        barMaxWidth: 40,
                        data: seriesData
                    },
                    {
                        name:"销售公司成本",
                        type: 'bar',
                        stack: 'Ad',
                        barMaxWidth: 40,
                        data: seriesData1
                    }
                ]
            };
            this.chart5Option = option;
            this.$refs.chart5.init(echarts, chart=> {
                chart.setOption(this.chart5Option);
                chart.dispatchAction({
                    type: 'showTip',
                    seriesIndex: 0,
                    dataIndex: 0
                })
            });
        },
        //地图
        getChart6Option(){
            // var data = [
            //     {name:"四川",value:3},
            //     {name:"贵州",value:53},
            // ]
            var data = this.countryTableData.map(item=>{
                return {
                    name:item.cityName.replace('省',''),
                    value:item.totalRevenue,
                    date:item.batchNo,
                    cityId:item.cityId
                }
            })
            this.$refs.chart6.init(echarts,async chart => {
                const chinaJson = await this.getData();
                echarts.registerMap('china', chinaJson);
                const option = {
                    tooltip: {
                        trigger: 'item',
                        position: (point, params, dom, rect, size) => {
                            // 假设自定义的tooltips尺寸
                            const box = [133, 64]
                            // 偏移
                            const offsetX = point[0] < size.viewSize[0] / 2 ? 20 : -box[0] - 20;
                            const offsetY = point[1] < size.viewSize[1] / 2 ? 20 : -box[1] - 20;
                            const x = point[0] + offsetX;
                            const y = point[1] + offsetY;
                            // this.chart6.position = [x, point[1]]
                            // console.log(params)
                            if(params.data){
                                this.chart6.params = params
                                this.chart6.position = [80,0];
                            }else{
                                this.chart6.position = [];
                            }

                        },
                        formatter: (params, ticket, callback) => {
                        }
                    },
                    // geo: {
                    //   map: 'china',
                    //   roam: false, // 是否开启放大缩小/拖拽功能
                    //   zoom: 1.2, // 缩放比列
                    //   layoutCenter: ['50%', '50%'], // 地图中心点位置
                    //   layoutSize: '100%',
                    //   label: {
                    //     show: true,
                    //     color: '#fff'
                    //   },
                    //   itemStyle: {
                    //     areaColor: '#FFF',
                    //     borderColor: '#676666',
                    //     borderWidth: 1,
                    //   },
                    //   // emphasis: { //区域激活时的样式
                    //   //   itemStyle: {
                    //   //     areaColor: '#02102b',
                    //   //   },
                    //   //   label: {
                    //   //     color: "#fff"
                    //   //   }
                    //   // }
                    // },
                    series:[
                        {
                            type: 'map',
                            mapType: 'china',
                            geoIndex: -1,
                            zoom: 1.2, //默认显示级别
                            label: {
                                show: false,
                            },
                            itemStyle: {
                                normal: {
                                    borderColor: '#676666',
                                    borderWidth: 1,
                                    areaColor: '#FFF'
                                },
                                emphasis: {
                                    areaColor: '#FA8C16',
                                    borderWidth: 0,
                                    color: 'green'
                                }
                            },
                            data: data
                        }
                    ]
                }
                chart.setOption(option);
                // chart.dispatchAction({
                //     type: 'showTip',
                //     seriesIndex: 0,
                //     dataIndex: 2
                // })
            })
        },
        getChart7Option(){
            const app = this;
            this.chart7.data = [
                {
                    name:'快眼传媒',
                    value:111,
                    icon:this.$Config.get('imageUrl')+'/data/shop.png'
                },
                {
                    name:'宝洞家',
                    value:123,
                    icon:this.$Config.get('imageUrl')+'/data/shop.png'
                },
                {
                    name:'众联',
                    value:154,
                    icon:this.$Config.get('imageUrl')+'/data/shop.png'
                },
                {
                    name:'快眼传媒',
                    value:215,
                    icon:this.$Config.get('imageUrl')+'/data/shop.png'
                },
            ];
            let max = 300
            this.$nextTick(()=>{
                setTimeout(function () {
                    // console.log(app.$refs)
                    app.chart7.data.forEach((item,i)=>{
                        const ref = app.$refs['chart7-'+i][0];
                        ref.init(echarts,async chart => {
                            const option = {
                                grid: {
                                    top: 0,
                                    left:0,
                                    right:0,
                                    bottom: 0
                                },
                                xAxis: {
                                    type: 'value',
                                    max: max,
                                    splitLine: {
                                        show: false
                                    },
                                    axisTick: {
                                        show: false
                                    },
                                    axisLine: {
                                        show: false
                                    },
                                    axisLabel: {
                                        show: false
                                    }
                                },
                                yAxis: {
                                    type: 'category',
                                    axisLine: {
                                        show: false //隐藏X轴轴线
                                    },
                                    axisTick: {
                                        show: false //隐藏X轴刻度
                                    },
                                    axisLabel: {
                                        show: false
                                    }
                                },
                                series: [
                                    {
                                        type: 'bar',
                                        barWidth: '100%',
                                        showBackground: true,
                                        backgroundStyle: {
                                            color: 'rgba(23,119,255,0.1)'
                                        },
                                        itemStyle:{
                                            color:'rgba(23,119,255,1)'
                                        },
                                        data: [item.value]
                                    }
                                ]
                            }
                            chart.setOption(option);
                        })
                    })
                },500)
            })
        },
        //地图json数据
        getData() {
            return new Promise(resolve => {
                uni.request({
                    url: this.$Config.get('httpsImageUrl')+'/100000_full.json',
                    success(res) {
                        setTimeout(() => {
                            resolve(res.data);
                        }, 200)
                    }
                });
            });
        },
        getEchart(){
            return new Promise(resolve => {
                uni.request({
                    url: this.$Config.get('imageUrl')+'/echarts.min.js',
                    success(res) {
                        setTimeout(() => {
                            resolve(res.data);
                        }, 200)
                    }
                });
            });
        },
        //总营收，总利润
        revenueListByType(){
            const app = this;
            // 1 year 2 quarter 3 month
            let arr = [,'year','quarter','month','day'];
            let params = {
                showType:arr[this.filter1]
            }
            return new Promise((resolve,reject) => {
                app.$request.get('wx/revenue/listByType',params,{load:false}).then(res=>{
                    resolve(res.data.items)
                }).catch(err=>{
                    app.$toast(err.errmsg)
                    reject(err)
                })
            })
        },
        //全国营收
        listByCity(){
            const app = this;
            // 1 year 2 quarter 3 month
            let arr = [,'year','quarter','month','day'];
            let params = {
                showType:arr[this.filter1]
            }
            return new Promise((resolve,reject) => {
                app.$request.get('wx/revenue/listByCity',params,{load:false}).then(res=>{
                    let data = res.data.items.map(item=>{
                        let city = this.treeData.find(city=>city.id == item.cityId);
                        let cityName = city?city.name:'';
                        // console.log(city)
                        return {
                            ...item,
                            cityId:item.cityId,
                            cityName:cityName,
                            totalRevenue:item.totalRevenue,
                        }
                    })
                    resolve(data)
                }).catch(err=>{
                    app.$toast(err.errmsg)
                    reject(err)
                })
            })
        },
        //城市营收
        detailByCity(id){
            this.chart6.position = [];
            // console.log(this.countryTableData,id)
            const data = this.countryTableData.find(item=>item.cityId == id);
            // console.log(data)
            if(!data){
                return;
            }
            // let fmt = 'yyyy'
            // if(this.filter1 == 2){
            //     fmt = 'yyyy-qq'
            // }else if(this.filter1 == 3){
            //     fmt = 'yyyy-MM'
            // }
            // const time = this.dateFormat(data.revenueTime.replaceAll('-','/'),fmt);
            // console.log(time,data.totalRevenue)
            this.chart6.params={
                name:data.batchNo ,
                city:data.cityName,
                value:data.totalRevenue
            }
            this.chart6.position = [80,110];
        },
        getTableHeader(filter){
            if(filter == 1){
                return '年'
            }else if(filter == 2){
                return '季度'
            }else if(filter == 3){
                return '月'
            }else if(filter == 4){
                return '日'
            }
        },
        getDetailByDistribution(id){
            const app = this;
            let arr = [,'year','quarter','month','day'];
            let params = {
                showType:arr[this.filter1]
            }
            return new Promise((resolve,reject) => {
                app.$request.get('wx/revenue/detailByDistribution', params,{load:false}).then(res=>{
                    resolve(res.data)
                }).catch(err=>{
                    app.$toast(err.errmsg)
                    reject(err)
                })
            })
        },
        //商城总营收，总利润
        agencyOrder(){
            const app = this;
            let arr = [,'year','quarter','month','day'];
            let params = {
                showType:arr[this.filter1]
            }
            return new Promise((resolve,reject) => {
                app.$request.get('wx/agencyOrder/listByType', params,{load:false}).then(res=>{
                    resolve(res.data.items)
                }).catch(err=>{
                    app.$toast(err.errmsg)
                    reject(err)
                })
            })
        },
        // 获取地区数据
        getTreeData() {
            RegionModel.getRegionList(true).then(regions => {
                this.treeData = regions;
            })
        },
        dateFormat(date, fmt) {
            if(date == null || date == undefined || date == ''){
                return ''
            }
            date = new Date(date);
            var a = ["日", "一", "二", "三", "四", "五", "六"];
            var o = {
                "M+": date.getMonth() + 1, // 月份
                "d+": date.getDate(), // 日
                "h+": date.getHours(), // 小时
                "m+": date.getMinutes(), // 分
                "s+": date.getSeconds(), // 秒
                "q+": Math.floor((date.getMonth() + 3) / 3), // 季度
                S: date.getMilliseconds(), // 毫秒
                w: date.getDay(), // 周
                W: a[date.getDay()], // 大写周
                T: "T",
            };
            if (/(y+)/.test(fmt)) {
                fmt = fmt.replace(
                    RegExp.$1,
                    (date.getFullYear() + "").substr(4 - RegExp.$1.length)
                );
            }
            for (var k in o) {
                if (new RegExp("(" + k + ")").test(fmt)) {
                    fmt = fmt.replace(
                        RegExp.$1,
                        RegExp.$1.length === 1
                            ? o[k]
                            : ("00" + o[k]).substr(("" + o[k]).length)
                    );
                }
            }
            return fmt;
        },
        //出厂成本、销售公司成本图表
        costListByType(){
            const app = this;
            // 1 year 2 quarter 3 month
            let arr = [,'year','quarter','month','day'];
            let params = {
                showType:arr[this.filter2]
            }
            return new Promise((resolve,reject) => {
                app.$request.get('wx/cost/listByType',params,{load:false}).then(res=>{
                    let data = res.data.items;
                    resolve(data)
                }).catch(err=>{
                    app.$toast(err.errmsg)
                    reject(err)
                })
            })
        },
        chooseImage(index){
            const app = this

            // 选择图片
            uni.chooseImage({
                // count: maxImageLength - oldImageList.length,
                sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
                sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
                // success({ tempFiles }) {
                //     // tempFiles = [{path:'xxx', size:100}]
                //     // app.files[index].imageList = oldImageList.concat(tempFiles)
                //     app.uploadFilePromise(tempFiles[0].path).then(url=>{
                //         app.files[index] = oldImageList.concat({path:url})
                //     })
                // }
                success: ({tempFiles})=>app.chooseImageSuccess(tempFiles,index)
            });
        },
        async chooseImageSuccess(tempFiles,index){
            const app = this;
            const oldImageList = app.files[index]
            const url = await app.uploadFilePromise(tempFiles[0].path)
            app.files[index] = oldImageList.concat({path:url});
            const result = await app.submitFiles()
        },
        uploadFilePromise(url) {
            const app = this;
            return new Promise((resolve, reject) => {
                app.$request.urlFileUpload('wx/storage/upload',{
                    files: [{path:url}], // 必填 临时文件路径 格式: [{path: "图片地址"}]
                    // data:"向服务器传递的参数", //可不填
                    // name:"后台接受文件key名称", //默认 file
                }).then(res=>{
                    const data = res[0].data.url;
                    resolve(data)
                }).catch(err=>{
                    app.$toast(err.errmsg)
                    reject(err)
                })

            })
        },
        submitFiles(){
            const app = this;
            return new Promise((resolve, reject) => {
                let costFileUrls = app.files[0].map((item,i)=>{
                    const key = 'file'+(i+1)
                    return {
                        [key]:item.path
                    }
                })
                costFileUrls = JSON.stringify(costFileUrls)
                let taxFileUrls = app.files[1].map((item,i)=>{
                    const key = 'file'+(i+1)
                    return {
                        [key]:item.path
                    }
                })
                taxFileUrls = JSON.stringify(taxFileUrls)
                let params = {
                    costFileUrls,
                    taxFileUrls,
                }
                app.$request.post('wx/cost/filesInfoSubmit',params).then(res=>{
                    resolve(res)
                }).catch(err=> {
                    app.$toast(err.errmsg)
                    reject(err)
                })
            })

        },
        delFile(file,index,fileIndex){
            const app = this;
            uni.showModal({
                title: '温馨提示',
                content: '确定要删除此文件吗？',
                success: function (res) {
                    if (res.confirm) {
                        app.files[fileIndex].splice(index,1)
                        app.submitFiles()
                    }
                }
            });
        },
        getFiles(){
            const app = this;
            return new Promise((resolve, reject) => {
                app.$request.get('wx/cost/filesInfo',{},{load:false}).then(res=>{
                    const data = JSON.parse(res.data.fileUrls);

                    let costFileUrls = JSON.parse(data.costFileUrls).map(item=>{
                        return {
                            path:Object.values(item)[0]
                        }
                    });
                    let taxFileUrls = JSON.parse(data.taxFileUrls).map(item=>{
                        return {
                            path:Object.values(item)[0]
                        }
                    });
                    app.files = [
                        costFileUrls,
                        taxFileUrls
                    ]
                    console.log(app.files)
                    resolve(res)
                }).catch(err=> {
                    app.$toast(err.errmsg)
                    reject(err)
                })
            })

        },
        //https://dev.gzbdjy.com/storage/7m3gwywx8p2nlyg84v5x.jpg
        getFileName(url){
            //通过url 取7m3gwywx8p2nlyg84v5x.jpg
            let arr = url.split('/');
            return arr[arr.length-1]
        },
        getNumber(value){
            //大数字显示万 123456789 显示 1234.5万 大数字显示亿 1234567890 显示 1234.5亿
            // if(value >= 10000){
            //     return (value/10000).toFixed(2)
            // }else{
            //     return value
            // }
            return value
        },
        getNumber1(value){
            //大数字显示万 123456789 显示 1234.5万 大数字显示亿 1234567890 显示 1234.5亿
            if(value >= 10000){
                return (value/10000).toFixed(2) +'万'
            }else{
                return value
            }
        },
        //数字 千位分隔
        getShowNumber(value){
            return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
        }
    },
}